home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / mxcode / ampegsrc / decodsrc / decode.c < prev    next >
Encoding:
Text File  |  1994-11-11  |  56.5 KB  |  1,817 lines

  1. { draw image }
  2.      Delay(PauseTime);
  3. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  4.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  5.   until KeyPressed;
  6.   FreeMem(Saucer, size);
  7.   WaitToGo;
  8. end; { PutImagePlay }
  9.  
  10. procedure PolyPlay;
  11. { Draw random polygons with random fill styles on the screen }
  12. const
  13.   MaxPts = 5;
  14. type
  15.   PolygonType = array[1..MaxPts] of PointType;
  16. var
  17.   Poly : PolygonType;
  18.   I, Color : word;
  19. begin
  20.   MainWindow('FillPoly demonstration');
  21.   StatusLine('Esc aborts or press a key...');
  22.   repeat
  23.     Color := RandColor;
  24.     SetFillStyle(Random(11)+1, Color);
  25.     SetColor(Color);
  26.     for I := 1 to MaxPts do
  27.       with Poly[I] do
  28.       begin
  29.         X := Random(MaxX);
  30.         Y := Random(MaxY);
  31.       end;
  32.     FillPoly(MaxPts, Poly);
  33.   until KeyPressed;
  34.   WaitToGo;
  35. end; { PolyPlay }
  36.  
  37. procedure FillStylePlay;
  38. { Display all of the predefined fill styles available }
  39. var
  40.   Style    : word;
  41.   Width    : word;
  42.   Height   : word;
  43.   X, Y     : word;
  44.   I, J     : word;
  45.   ViewInfo : ViewPortType;
  46.  
  47. procedure DrawBox(X, Y : word);
  48. begin
  49.   SetFillStyle(Style, MaxColor);
  50.   with ViewInfo do
  51.     Bar(X, Y, X+Width, Y+Height);
  52.   Rectangle(X, Y, X+Width, Y+Height);
  53.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  54.   Inc(Style);
  55. end; { DrawBox }
  56.  
  57. begin
  58.   MainWindow('Pre-defined fill styles');
  59.   GetViewSettings(ViewInfo);
  60.   with ViewInfo do
  61.   begin
  62.     Width := 2 * ((x2+1) div 13);
  63.     Height := 2 * ((y2-10) div 10);
  64.   end;
  65.   X := Width div 2;
  66.   Y := Height div 2;
  67.   Style := 0;
  68.   for J := 1 to 3 do
  69.   begin
  70.     for I := 1 to 4 do
  71.     begin
  72.       DrawBox(X, Y);
  73.       Inc(X, (Width div 2) * 3);
  74.     end;
  75.     X := Width div 2;
  76.     Inc(Y, (Height div 2) * 3);
  77.   end;
  78.   SetTextJustify(LeftText, TopText);
  79.   WaitToGo;
  80. end; { FillStylePlay }
  81.  
  82. procedure FillPatternPlay;
  83. { Display some user defined fill patterns }
  84. const
  85.   Patterns : array[0..11] of FillPatternType = (
  86.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  87.             OldColor which has a path of pixels of OldColor or NewColor
  88.             with sides touching back to the seed point, (XSeed, YSeed).
  89.             Therefore, only pixels of OldColor are modified and no other
  90.             information is changed.
  91.  
  92.             SEE ALSO
  93.  
  94.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  95.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  96.             SETVIEW
  97.  
  98.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  99.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  100.             IF WHICHVGA = 0 THEN STOP
  101.             DUMMY=RES640
  102.             SETVIEW 100, 100, 539, 379
  103.             FILLVIEW 10
  104.             WHILE INKEY$ = ""
  105.             WEND
  106.             VIDEOMODESET VMODE
  107.             END
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.                                                                          63
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.           FONTGETINFO
  132.  
  133.             PROTOTYPE
  134.  
  135.             SUB FONTGETINFO (Width%, Height%)
  136.  
  137.             INPUT
  138.  
  139.             no input parameters
  140.     WEND
  141.             MOUSEEXIT
  142.             VIDEOMODESET VMODE
  143.             END
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.                                                                          86
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.           MOUSECURSORDEFAULT
  192.  
  193.             PROTOTYPE
  194.  
  195.             SUB MOUSECURSORDEFAULT ()
  196.  
  197.             INPUT
  198.  
  199.             no input parameters
  200.  
  201.             OUTPUT
  202.  
  203.             no value returned
  204.  
  205.             USAGE
  206.  
  207.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  208.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  209. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  210. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  211. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  212. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  213. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  214. $╤
  215. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  216. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  217. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  218. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  219. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  220. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  221. ░£▒
  222. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  223. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  224.       end;
  225.     end;
  226.   end;
  227.   WaitToGo;
  228. end; { UserLineStylePlay }
  229.  
  230.  
  231. procedure SayGoodbye;
  232. { Say goodbye and then exit the program }
  233. var
  234.   ViewInfo : ViewPortType;
  235. begin
  236.   MainWindow('');
  237.   GetViewSettings(ViewInfo);
  238.   SetTextStyle(TriplexFont, HorizDir, 4);
  239.   SetTextJustify(CenterText, CenterText);
  240.   with ViewInfo do
  241.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  242.   StatusLine('Press any key to quit...');
  243.   repeat until KeyPressed;
  244. end; { SayGoodbye }
  245.  
  246.  
  247. PROCEDURE SelectMode;
  248. VAR
  249.     choice1,choice2     : CHAR;
  250.    xsize,ysize            : WORD;
  251. BEGIN
  252.     (* Let's select a mode *)
  253.     ClrScr;
  254.     WriteLn('VESADEMO:');
  255.     WriteLn('1. 256 colors');
  256.     WriteLn('2. 32768 colors');
  257.     WriteLn('3. 65536 colors');
  258.     WriteLn('4. 16777216 colors');
  259.     WriteLn('Q uit');
  260.     WriteLn;
  261.     Write('Your choice: ');
  262.     REPEAT
  263.         ReadLn(choice1);
  264.       IF choice1 <> '1' THEN BEGIN
  265.           WriteLn('Sorry !');
  266.          WriteLn('This demo wasn''t written for more as 256 colors !');
  267.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  268.          WriteLn('Switching to 256 colors.');
  269.          choice1 := '1';
  270.       END;
  271.     UNTIL choice1 IN ['1'..'4','q'];
  272.     IF choice1 = 'q' THEN Halt;
  273.  
  274.     WriteLn;
  275.     WriteLn;
  276.     WriteLn('a. 320x200');
  277.     WriteLn('b. 640x480');
  278.     WriteLn('c. 800x600');
  279.     WriteLn('d. 1024x768');
  280.     WriteLn('e. 1280x1024');
  281.     WriteLn('Q uit');
  282.     WriteLn;
  283.     Write('Your choice: ');
  284.     REPEAT
  285.         ReadLn(choice2);
  286.     UNTIL choice2 IN ['a'..'e','q'];
  287.     IF choice2 = 'q' THEN Halt;
  288.  
  289.     CASE choice2 OF
  290.         'a' : BEGIN
  291.             xsize := 320;
  292.             ysize := 200;
  293.         END;
  294.         'b' : BEGIN
  295.             xsize := 640;
  296.             ysize := 480;
  297.         END;
  298.         'c' : BEGIN
  299.             xsize := 800;
  300.             ysize := 600;
  301.         END;
  302.         'd' : BEGIN
  303.             xsize := 1024;
  304.             ysize := 768;
  305.         END;
  306.         'e' : BEGIN
  307.             xsize := 1280;
  308.             ysize := 1024;
  309.         END;
  310.     END;
  311.     CASE choice1 OF
  312.         '1' : mode := FindVesaMode(xsize,ysize,8);
  313.         '2' : mode := FindVesaMode(xsize,ysize,15);
  314.         '3' : mode := FindVesaMode(xsize,ysize,16);
  315.         '4' : mode := FindVesaMode(xsize,ysize,24);
  316.     END;
  317.     IF mode = 0 THEN BEGIN
  318.         WriteLn('No such mode could be found !');
  319.         WriteLn('Switching to to 320x200.');
  320.         ReadKey;
  321.         mode := V320x200x256;
  322.     END;
  323. END;
  324.  
  325. begin { program body }
  326.   SelectMode;
  327.   Initialize;
  328.   ReportStatus;
  329.  
  330. {  AspectRatioPlay; }
  331.   FillEllipsePlay;
  332.   SectorPlay;
  333.   WriteModePlay;
  334.  
  335.   ColorPlay;
  336.   { PalettePlay only intended to work on these drivers: }
  337.   if (GraphDriver = EGA) or
  338.       (GraphDriver = EGA64) or
  339.       (GraphDriver = VGA) then
  340.      PalettePlay;
  341.   PutPixelPlay;
  342. {  PutImagePlay; }
  343.   RandBarPlay;
  344.   BarPlay;
  345.   Bar3DPlay;
  346.   ArcPlay;
  347.   CirclePlay;
  348.   PiePlay;
  349.   LineToPlay;
  350.   LineRelPlay;
  351. {  LineStylePlay; }
  352. {  UserLineStylePlay; }
  353.   TextDump;
  354.   TextPlay;
  355.   CrtModePlay;
  356.   FillStylePlay;
  357.   FillPatternPlay;
  358.   PolyPlay;
  359.   SayGoodbye;
  360. {  CloseGraph; }
  361.   CloseVesa;
  362. end.
  363. ***************************************************
  364.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  365.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  366. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  367. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  368. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  369. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  370.     Color := RandColor;
  371.     SetColor(Color);
  372.     SetFillStyle(Random(CloseDotFill)+1, Color);
  373.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  374.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  375.   until KeyPressed;
  376.   WaitToGo;
  377. end; { RandBarPlay }
  378.  
  379. procedure ArcPlay;
  380. { Draw random arcs on the screen }
  381. var
  382.   MaxRadius : word;
  383.   EndAngle : word;
  384.   ArcInfo : ArcCoordsType;
  385. begin
  386.   MainWindow('Arc / GetArcCoords demonstration');
  387.   StatusLine('Esc aborts or press a key');
  388.   MaxRadius := MaxY div 10;
  389.   repeat
  390.     SetColor(RandColor);
  391.     EndAngle := Random(360);
  392.     SetLineStyle(SolidLn, 0, NormWidth);
  393.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  394.     GetArcCoords(ArcInfo);
  395.     with ArcInfo do
  396.     begin
  397.       Line(X, Y, XStart, YStart);
  398.       Line(X, Y, Xend, Yend);
  399.     end;
  400.   until KeyPressed;
  401.   WaitToGo;
  402. end; { ArcPlay }
  403.  
  404. procedure PutPixelPlay;
  405. { Demonstrate the PutPixel and GetPixel commands }
  406. const
  407.   Seed   = 1962; { A seed for the random number generator }
  408.   NumPts = 2000; { The number of pixels plotted }
  409.   Esc    = #27;
  410. var
  411.   I : word;
  412.   X, Y, Color : word;
  413.   XMax, YMax  : integer;
  414.   ViewInfo    : ViewPortType;
  415. begin
  416.   MainWindow('PutPixel / GetPixel demonstration');
  417.   StatusLine('Esc aborts or press a key...');
  418.  
  419.   GetViewSettings(ViewInfo);
  420.   with ViewInfo do
  421.   begin
  422.     XMax := (x2-x1-1);
  423.     YMax := (y2-y1-1);
  424.   end;
  425.  
  426.   while not KeyPressed do
  427.   begin
  428.     { Plot random pixels }
  429.     RandSeed := Seed;
  430.     I := 0;
  431.     while (not KeyPressed) and (I < NumPts) do
  432.     begin
  433.       Inc(I);
  434.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  435.     end;
  436.  
  437.     { Erase pixels }
  438.     RandSeed := Seed;
  439.     I := 0;
  440.     while (not KeyPressed) and (I < NumPts) do
  441.     begin
  442.       Inc(I);
  443.       X := Random(XMax)+1;
  444.       Y := Random(YMax)+1;
  445.       Color := GetPixel(X, Y);
  446.         if Color = RandColor then
  447.           PutPixel(X, Y, 0);
  448.      end;
  449.   end;
  450.   WaitToGo;
  451. end; { PutPixelPlay }
  452.  
  453. procedure PutImagePlay;
  454. { Demonstrate the GetImage and PutImage commands }
  455.  
  456. const
  457.   r  = 20;
  458.   StartX = 100;
  459.   StartY = 50;
  460.  
  461. var
  462.   CurPort : ViewPortType;
  463.  
  464. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  465. var
  466.   Step : integer;
  467. begin
  468.   Step := Random(2*r);
  469.   if Odd(Step) then
  470.     Step := -Step;
  471.   X := X + Step;
  472.   Step := Random(r);
  473.   if Odd(Step) then
  474.     Step := -Step;
  475.   Y := Y + Step;
  476.  
  477.   { Make saucer bounce off viewport walls }
  478.   with CurPort do
  479.   begin
  480.     if (x1 + X + Width - 1 > x2) then
  481.       X := x2-x1 - Width + 1
  482.     else
  483.       if (X < 0) then
  484.         X := 0;
  485.     if (y1 + Y + Height - 1 > y2) then
  486.       Y := y2-y1 - Height + 1
  487.     else
  488.       if (Y < 0) then
  489.         Y := 0;
  490.   end;
  491. end; { MoveSaucer }
  492.  
  493. var
  494.   Pausetime : word;
  495.   Saucer    : pointer;
  496.   X, Y      : integer;
  497.   ulx, uly  : word;
  498.   lrx, lry  : word;
  499.   Size      : word;
  500.   I         : word;
  501. begin
  502.   ClearDevice;
  503.   FullPort;
  504.  
  505.   { PaintScreen }
  506.   ClearDevice;
  507.   MainWindow('GetImage / PutImage Demonstration');
  508.   StatusLine('Esc aborts or press a key...');
  509.   GetViewSettings(CurPort);
  510.  
  511.   { DrawSaucer }
  512.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  513.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  514.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  515.   Circle(StartX+10, StartY-12, 2);
  516.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  517.   Circle(StartX-10, StartY-12, 2);
  518.   SetFillStyle(SolidFill, MaxColor);
  519.   FloodFill(StartX+1, StartY+4, GetColor);
  520.  
  521.   { ReadSaucerImage }
  522.   ulx := StartX-(r+1);
  523.   uly := StartY-14;
  524.   lrx := StartX+(r+1);
  525.   lry := StartY+(r div 3)+3;
  526.  
  527.   Size := ImageSize(ulx, uly, lrx, lry);
  528.   GetMem(Saucer, Size);
  529.   GetImage(ulx, uly, lrx, lry, Saucer^);
  530. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  531.  
  532.   { Plot some "stars" }
  533.   for I := 1 to 1000 do
  534.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  535.   X := MaxX div 2;
  536.   Y := MaxY div 2;
  537.   PauseTime := 70;
  538.  
  539.   { Move the saucer around }
  540.   repeat
  541. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  542.      Delay(PauseTime);
  543. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  544.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  545.   until KeyPressed;
  546.   FreeMem(Saucer, size);
  547.   WaitToGo;
  548. end; { PutImagePlay }
  549.  
  550. procedure PolyPlay;
  551. { Draw random polygons with random fill styles on the screen }
  552. const
  553.   MaxPts = 5;
  554. type
  555.   PolygonType = array[1..MaxPts] of PointType;
  556. var
  557.   Poly : PolygonType;
  558.   I, Color : word;
  559. begin
  560.   MainWindow('FillPoly demonstration');
  561.   StatusLine('Esc aborts or press a key...');
  562.   repeat
  563.     Color := RandColor;
  564.     SetFillStyle(Random(11)+1, Color);
  565.     SetColor(Color);
  566.     for I := 1 to MaxPts do
  567.       with Poly[I] do
  568.       begin
  569.         X := Random(MaxX);
  570.         Y := Random(MaxY);
  571.       end;
  572.     FillPoly(MaxPts, Poly);
  573.   until KeyPressed;
  574.   WaitToGo;
  575. end; { PolyPlay }
  576.  
  577. procedure FillStylePlay;
  578. { Display all of the predefined fill styles available }
  579. var
  580.   Style    : word;
  581.   Width    : word;
  582.   Height   : word;
  583.   X, Y     : word;
  584.   I, J     : word;
  585.   ViewInfo : ViewPortType;
  586.  
  587. procedure DrawBox(X, Y : word);
  588. begin
  589.   SetFillStyle(Style, MaxColor);
  590.   with ViewInfo do
  591.     Bar(X, Y, X+Width, Y+Height);
  592.   Rectangle(X, Y, X+Width, Y+Height);
  593.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  594.   Inc(Style);
  595. end; { DrawBox }
  596.  
  597. begin
  598.   MainWindow('Pre-defined fill styles');
  599.   GetViewSettings(ViewInfo);
  600.   with ViewInfo do
  601.   begin
  602.     Width := 2 * ((x2+1) div 13);
  603.     Height := 2 * ((y2-10) div 10);
  604.   end;
  605.   X := Width div 2;
  606.   Y := Height div 2;
  607.   Style := 0;
  608.   for J := 1 to 3 do
  609.   begin
  610.     for I := 1 to 4 do
  611.     begin
  612.       DrawBox(X, Y);
  613.       Inc(X, (Width div 2) * 3);
  614.     end;
  615.     X := Width div 2;
  616.     Inc(Y, (Height div 2) * 3);
  617.   end;
  618.   SetTextJustify(LeftText, TopText);
  619.   WaitToGo;
  620. end; { FillStylePlay }
  621.  
  622. procedure FillPatternPlay;
  623. { Display some user defined fill patterns }
  624. const
  625.   Patterns : array[0..11] of FillPatternType = (
  626.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  627.             OldColor which has a path of pixels of OldColor or NewColor
  628.             with sides touching back to the seed point, (XSeed, YSeed).
  629.             Therefore, only pixels of OldColor are modified and no other
  630.             information is changed.
  631.  
  632.             SEE ALSO
  633.  
  634.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  635.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  636.             SETVIEW
  637.  
  638.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  639.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  640.             IF WHICHVGA = 0 THEN STOP
  641.             DUMMY=RES640
  642.             SETVIEW 100, 100, 539, 379
  643.             FILLVIEW 10
  644.             WHILE INKEY$ = ""
  645.             WEND
  646.             VIDEOMODESET VMODE
  647.             END
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                                                                          63
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.           FONTGETINFO
  672.  
  673.             PROTOTYPE
  674.  
  675.             SUB FONTGETINFO (Width%, Height%)
  676.  
  677.             INPUT
  678.  
  679.             no input parameters
  680.     WEND
  681.             MOUSEEXIT
  682.             VIDEOMODESET VMODE
  683.             END
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.                                                                          86
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.           MOUSECURSORDEFAULT
  732.  
  733.             PROTOTYPE
  734.  
  735.             SUB MOUSECURSORDEFAULT ()
  736.  
  737.             INPUT
  738.  
  739.             no input parameters
  740.  
  741.             OUTPUT
  742.  
  743.             no value returned
  744.  
  745.             USAGE
  746.  
  747.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  748.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  749. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  750. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  751. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  752. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  753. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  754. $╤
  755. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  756. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  757. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  758. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  759. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  760. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  761. ░£▒
  762. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  763. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  764.       end;
  765.     end;
  766.   end;
  767.   WaitToGo;
  768. end; { UserLineStylePlay }
  769.  
  770.  
  771. procedure SayGoodbye;
  772. { Say goodbye and then exit the program }
  773. var
  774.   ViewInfo : ViewPortType;
  775. begin
  776.   MainWindow('');
  777.   GetViewSettings(ViewInfo);
  778.   SetTextStyle(TriplexFont, HorizDir, 4);
  779.   SetTextJustify(CenterText, CenterText);
  780.   with ViewInfo do
  781.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  782.   StatusLine('Press any key to quit...');
  783.   repeat until KeyPressed;
  784. end; { SayGoodbye }
  785.  
  786.  
  787. PROCEDURE SelectMode;
  788. VAR
  789.     choice1,choice2     : CHAR;
  790.    xsize,ysize            : WORD;
  791. BEGIN
  792.     (* Let's select a mode *)
  793.     ClrScr;
  794.     WriteLn('VESADEMO:');
  795.     WriteLn('1. 256 colors');
  796.     WriteLn('2. 32768 colors');
  797.     WriteLn('3. 65536 colors');
  798.     WriteLn('4. 16777216 colors');
  799.     WriteLn('Q uit');
  800.     WriteLn;
  801.     Write('Your choice: ');
  802.     REPEAT
  803.         ReadLn(choice1);
  804.       IF choice1 <> '1' THEN BEGIN
  805.           WriteLn('Sorry !');
  806.          WriteLn('This demo wasn''t written for more as 256 colors !');
  807.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  808.          WriteLn('Switching to 256 colors.');
  809.          choice1 := '1';
  810.       END;
  811.     UNTIL choice1 IN ['1'..'4','q'];
  812.     IF choice1 = 'q' THEN Halt;
  813.  
  814.     WriteLn;
  815.     WriteLn;
  816.     WriteLn('a. 320x200');
  817.     WriteLn('b. 640x480');
  818.     WriteLn('c. 800x600');
  819.     WriteLn('d. 1024x768');
  820.     WriteLn('e. 1280x1024');
  821.     WriteLn('Q uit');
  822.     WriteLn;
  823.     Write('Your choice: ');
  824.     REPEAT
  825.         ReadLn(choice2);
  826.     UNTIL choice2 IN ['a'..'e','q'];
  827.     IF choice2 = 'q' THEN Halt;
  828.  
  829.     CASE choice2 OF
  830.         'a' : BEGIN
  831.             xsize := 320;
  832.             ysize := 200;
  833.         END;
  834.         'b' : BEGIN
  835.             xsize := 640;
  836.             ysize := 480;
  837.         END;
  838.         'c' : BEGIN
  839.             xsize := 800;
  840.             ysize := 600;
  841.         END;
  842.         'd' : BEGIN
  843.             xsize := 1024;
  844.             ysize := 768;
  845.         END;
  846.         'e' : BEGIN
  847.             xsize := 1280;
  848.             ysize := 1024;
  849.         END;
  850.     END;
  851.     CASE choice1 OF
  852.         '1' : mode := FindVesaMode(xsize,ysize,8);
  853.         '2' : mode := FindVesaMode(xsize,ysize,15);
  854.         '3' : mode := FindVesaMode(xsize,ysize,16);
  855.         '4' : mode := FindVesaMode(xsize,ysize,24);
  856.     END;
  857.     IF mode = 0 THEN BEGIN
  858.         WriteLn('No such mode could be found !');
  859.         WriteLn('Switching to to 320x200.');
  860.         ReadKey;
  861.         mode := V320x200x256;
  862.     END;
  863. END;
  864.  
  865. begin { program body }
  866.   SelectMode;
  867.   Initialize;
  868.   ReportStatus;
  869.  
  870. {  AspectRatioPlay; }
  871.   FillEllipsePlay;
  872.   SectorPlay;
  873.   WriteModePlay;
  874.  
  875.   ColorPlay;
  876.   { PalettePlay only intended to work on these drivers: }
  877.   if (GraphDriver = EGA) or
  878.       (GraphDriver = EGA64) or
  879.       (GraphDriver = VGA) then
  880.      PalettePlay;
  881.   PutPixelPlay;
  882. {  PutImagePlay; }
  883.   RandBarPlay;
  884.   BarPlay;
  885.   Bar3DPlay;
  886.   ArcPlay;
  887.   CirclePlay;
  888.   PiePlay;
  889.   LineToPlay;
  890.   LineRelPlay;
  891. {  LineStylePlay; }
  892. {  UserLineStylePlay; }
  893.   TextDump;
  894.   TextPlay;
  895.   CrtModePlay;
  896.   FillStylePlay;
  897.   FillPatternPlay;
  898.   PolyPlay;
  899.   SayGoodbye;
  900. {  CloseGraph; }
  901.   CloseVesa;
  902. end.
  903. ***************************************************
  904.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  905.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  906. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  907. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  908. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  909. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  910.     Color := RandColor;
  911.     SetColor(Color);
  912.     SetFillStyle(Random(CloseDotFill)+1, Color);
  913.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  914.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  915.   until KeyPressed;
  916.   WaitToGo;
  917. end; { RandBarPlay }
  918.  
  919. procedure ArcPlay;
  920. { Draw random arcs on the screen }
  921. var
  922.   MaxRadius : word;
  923.   EndAngle : word;
  924.   ArcInfo : ArcCoordsType;
  925. begin
  926.   MainWindow('Arc / GetArcCoords demonstration');
  927.   StatusLine('Esc aborts or press a key');
  928.   MaxRadius := MaxY div 10;
  929.   repeat
  930.     SetColor(RandColor);
  931.     EndAngle := Random(360);
  932.     SetLineStyle(SolidLn, 0, NormWidth);
  933.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  934.     GetArcCoords(ArcInfo);
  935.     with ArcInfo do
  936.     begin
  937.       Line(X, Y, XStart, YStart);
  938.       Line(X, Y, Xend, Yend);
  939.     end;
  940.   until KeyPressed;
  941.   WaitToGo;
  942. end; { ArcPlay }
  943.  
  944. procedure PutPixelPlay;
  945. { Demonstrate the PutPixel and GetPixel commands }
  946. const
  947.   Seed   = 1962; { A seed for the random number generator }
  948.   NumPts = 2000; { The number of pixels plotted }
  949.   Esc    = #27;
  950. var
  951.   I : word;
  952.   X, Y, Color : word;
  953.   XMax, YMax  : integer;
  954.   ViewInfo    : ViewPortType;
  955. begin
  956.   MainWindow('PutPixel / GetPixel demonstration');
  957.   StatusLine('Esc aborts or press a key...');
  958.  
  959.   GetViewSettings(ViewInfo);
  960.   with ViewInfo do
  961.   begin
  962.     XMax := (x2-x1-1);
  963.     YMax := (y2-y1-1);
  964.   end;
  965.  
  966.   while not KeyPressed do
  967.   begin
  968.     { Plot random pixels }
  969.     RandSeed := Seed;
  970.     I := 0;
  971.     while (not KeyPressed) and (I < NumPts) do
  972.     begin
  973.       Inc(I);
  974.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  975.     end;
  976.  
  977.     { Erase pixels }
  978.     RandSeed := Seed;
  979.     I := 0;
  980.     while (not KeyPressed) and (I < NumPts) do
  981.     begin
  982.       Inc(I);
  983.       X := Random(XMax)+1;
  984.       Y := Random(YMax)+1;
  985.       Color := GetPixel(X, Y);
  986.         if Color = RandColor then
  987.           PutPixel(X, Y, 0);
  988.      end;
  989.   end;
  990.   WaitToGo;
  991. end; { PutPixelPlay }
  992.  
  993. procedure PutImagePlay;
  994. { Demonstrate the GetImage and PutImage commands }
  995.  
  996. const
  997.   r  = 20;
  998.   StartX = 100;
  999.   StartY = 50;
  1000.  
  1001. var
  1002.   CurPort : ViewPortType;
  1003.  
  1004. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  1005. var
  1006.   Step : integer;
  1007. begin
  1008.   Step := Random(2*r);
  1009.   if Odd(Step) then
  1010.     Step := -Step;
  1011.   X := X + Step;
  1012.   Step := Random(r);
  1013.   if Odd(Step) then
  1014.     Step := -Step;
  1015.   Y := Y + Step;
  1016.  
  1017.   { Make saucer bounce off viewport walls }
  1018.   with CurPort do
  1019.   begin
  1020.     if (x1 + X + Width - 1 > x2) then
  1021.       X := x2-x1 - Width + 1
  1022.     else
  1023.       if (X < 0) then
  1024.         X := 0;
  1025.     if (y1 + Y + Height - 1 > y2) then
  1026.       Y := y2-y1 - Height + 1
  1027.     else
  1028.       if (Y < 0) then
  1029.         Y := 0;
  1030.   end;
  1031. end; { MoveSaucer }
  1032.  
  1033. var
  1034.   Pausetime : word;
  1035.   Saucer    : pointer;
  1036.   X, Y      : integer;
  1037.   ulx, uly  : word;
  1038.   lrx, lry  : word;
  1039.   Size      : word;
  1040.   I         : word;
  1041. begin
  1042.   ClearDevice;
  1043.   FullPort;
  1044.  
  1045.   { PaintScreen }
  1046.   ClearDevice;
  1047.   MainWindow('GetImage / PutImage Demonstration');
  1048.   StatusLine('Esc aborts or press a key...');
  1049.   GetViewSettings(CurPort);
  1050.  
  1051.   { DrawSaucer }
  1052.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  1053.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  1054.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  1055.   Circle(StartX+10, StartY-12, 2);
  1056.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  1057.   Circle(StartX-10, StartY-12, 2);
  1058.   SetFillStyle(SolidFill, MaxColor);
  1059.   FloodFill(StartX+1, StartY+4, GetColor);
  1060.  
  1061.   { ReadSaucerImage }
  1062.   ulx := StartX-(r+1);
  1063.   uly := StartY-14;
  1064.   lrx := StartX+(r+1);
  1065.   lry := StartY+(r div 3)+3;
  1066.  
  1067.   Size := ImageSize(ulx, uly, lrx, lry);
  1068.   GetMem(Saucer, Size);
  1069.   GetImage(ulx, uly, lrx, lry, Saucer^);
  1070. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  1071.  
  1072.   { Plot some "stars" }
  1073.   for I := 1 to 1000 do
  1074.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  1075.   X := MaxX div 2;
  1076.   Y := MaxY div 2;
  1077.   PauseTime := 70;
  1078.  
  1079.   { Move the saucer around }
  1080.   repeat
  1081. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  1082.      Delay(PauseTime);
  1083. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  1084.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  1085.   until KeyPressed;
  1086.   FreeMem(Saucer, size);
  1087.   WaitToGo;
  1088. end; { PutImagePlay }
  1089.  
  1090. procedure PolyPlay;
  1091. { Draw random polygons with random fill styles on the screen }
  1092. const
  1093.   MaxPts = 5;
  1094. type
  1095.   PolygonType = array[1..MaxPts] of PointType;
  1096. var
  1097.   Poly : PolygonType;
  1098.   I, Color : word;
  1099. begin
  1100.   MainWindow('FillPoly demonstration');
  1101.   StatusLine('Esc aborts or press a key...');
  1102.   repeat
  1103.     Color := RandColor;
  1104.     SetFillStyle(Random(11)+1, Color);
  1105.     SetColor(Color);
  1106.     for I := 1 to MaxPts do
  1107.       with Poly[I] do
  1108.       begin
  1109.         X := Random(MaxX);
  1110.         Y := Random(MaxY);
  1111.       end;
  1112.     FillPoly(MaxPts, Poly);
  1113.   until KeyPressed;
  1114.   WaitToGo;
  1115. end; { PolyPlay }
  1116.  
  1117. procedure FillStylePlay;
  1118. { Display all of the predefined fill styles available }
  1119. var
  1120.   Style    : word;
  1121.   Width    : word;
  1122.   Height   : word;
  1123.   X, Y     : word;
  1124.   I, J     : word;
  1125.   ViewInfo : ViewPortType;
  1126.  
  1127. procedure DrawBox(X, Y : word);
  1128. begin
  1129.   SetFillStyle(Style, MaxColor);
  1130.   with ViewInfo do
  1131.     Bar(X, Y, X+Width, Y+Height);
  1132.   Rectangle(X, Y, X+Width, Y+Height);
  1133.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  1134.   Inc(Style);
  1135. end; { DrawBox }
  1136.  
  1137. begin
  1138.   MainWindow('Pre-defined fill styles');
  1139.   GetViewSettings(ViewInfo);
  1140.   with ViewInfo do
  1141.   begin
  1142.     Width := 2 * ((x2+1) div 13);
  1143.     Height := 2 * ((y2-10) div 10);
  1144.   end;
  1145.   X := Width div 2;
  1146.   Y := Height div 2;
  1147.   Style := 0;
  1148.   for J := 1 to 3 do
  1149.   begin
  1150.     for I := 1 to 4 do
  1151.     begin
  1152.       DrawBox(X, Y);
  1153.       Inc(X, (Width div 2) * 3);
  1154.     end;
  1155.     X := Width div 2;
  1156.     Inc(Y, (Height div 2) * 3);
  1157.   end;
  1158.   SetTextJustify(LeftText, TopText);
  1159.   WaitToGo;
  1160. end; { FillStylePlay }
  1161.  
  1162. procedure FillPatternPlay;
  1163. { Display some user defined fill patterns }
  1164. const
  1165.   Patterns : array[0..11] of FillPatternType = (
  1166.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  1167.             OldColor which has a path of pixels of OldColor or NewColor
  1168.             with sides touching back to the seed point, (XSeed, YSeed).
  1169.             Therefore, only pixels of OldColor are modified and no other
  1170.             information is changed.
  1171.  
  1172.             SEE ALSO
  1173.  
  1174.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  1175.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  1176.             SETVIEW
  1177.  
  1178.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  1179.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  1180.             IF WHICHVGA = 0 THEN STOP
  1181.             DUMMY=RES640
  1182.             SETVIEW 100, 100, 539, 379
  1183.             FILLVIEW 10
  1184.             WHILE INKEY$ = ""
  1185.             WEND
  1186.             VIDEOMODESET VMODE
  1187.             END
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.                                                                          63
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.           FONTGETINFO
  1212.  
  1213.             PROTOTYPE
  1214.  
  1215.             SUB FONTGETINFO (Width%, Height%)
  1216.  
  1217.             INPUT
  1218.  
  1219.             no input parameters
  1220.     WEND
  1221.             MOUSEEXIT
  1222.             VIDEOMODESET VMODE
  1223.             END
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.                                                                          86
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.           MOUSECURSORDEFAULT
  1272.  
  1273.             PROTOTYPE
  1274.  
  1275.             SUB MOUSECURSORDEFAULT ()
  1276.  
  1277.             INPUT
  1278.  
  1279.             no input parameters
  1280.  
  1281.             OUTPUT
  1282.  
  1283.             no value returned
  1284.  
  1285.             USAGE
  1286.  
  1287.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  1288.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  1289. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  1290. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  1291. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  1292. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  1293. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  1294. $╤
  1295. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  1296. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  1297. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  1298. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  1299. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  1300. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  1301. ░£▒
  1302. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  1303. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  1304.       end;
  1305.     end;
  1306.   end;
  1307.   WaitToGo;
  1308. end; { UserLineStylePlay }
  1309.  
  1310.  
  1311. procedure SayGoodbye;
  1312. { Say goodbye and then exit the program }
  1313. var
  1314.   ViewInfo : ViewPortType;
  1315. begin
  1316.   MainWindow('');
  1317.   GetViewSettings(ViewInfo);
  1318.   SetTextStyle(TriplexFont, HorizDir, 4);
  1319.   SetTextJustify(CenterText, CenterText);
  1320.   with ViewInfo do
  1321.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  1322.   StatusLine('Press any key to quit...');
  1323.   repeat until KeyPressed;
  1324. end; { SayGoodbye }
  1325.  
  1326.  
  1327. PROCEDURE SelectMode;
  1328. VAR
  1329.     choice1,choice2     : CHAR;
  1330.    xsize,ysize            : WORD;
  1331. BEGIN
  1332.     (* Let's select a mode *)
  1333.     ClrScr;
  1334.     WriteLn('VESADEMO:');
  1335.     WriteLn('1. 256 colors');
  1336.     WriteLn('2. 32768 colors');
  1337.     WriteLn('3. 65536 colors');
  1338.     WriteLn('4. 16777216 colors');
  1339.     WriteLn('Q uit');
  1340.     WriteLn;
  1341.     Write('Your choice: ');
  1342.     REPEAT
  1343.         ReadLn(choice1);
  1344.       IF choice1 <> '1' THEN BEGIN
  1345.           WriteLn('Sorry !');
  1346.          WriteLn('This demo wasn''t written for more as 256 colors !');
  1347.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  1348.          WriteLn('Switching to 256 colors.');
  1349.          choice1 := '1';
  1350.       END;
  1351.     UNTIL choice1 IN ['1'..'4','q'];
  1352.     IF choice1 = 'q' THEN Halt;
  1353.  
  1354.     WriteLn;
  1355.     WriteLn;
  1356.     WriteLn('a. 320x200');
  1357.     WriteLn('b. 640x480');
  1358.     WriteLn('c. 800x600');
  1359.     WriteLn('d. 1024x768');
  1360.     WriteLn('e. 1280x1024');
  1361.     WriteLn('Q uit');
  1362.     WriteLn;
  1363.     Write('Your choice: ');
  1364.     REPEAT
  1365.         ReadLn(choice2);
  1366.     UNTIL choice2 IN ['a'..'e','q'];
  1367.     IF choice2 = 'q' THEN Halt;
  1368.  
  1369.     CASE choice2 OF
  1370.         'a' : BEGIN
  1371.             xsize := 320;
  1372.             ysize := 200;
  1373.         END;
  1374.         'b' : BEGIN
  1375.             xsize := 640;
  1376.             ysize := 480;
  1377.         END;
  1378.         'c' : BEGIN
  1379.             xsize := 800;
  1380.             ysize := 600;
  1381.         END;
  1382.         'd' : BEGIN
  1383.             xsize := 1024;
  1384.             ysize := 768;
  1385.         END;
  1386.         'e' : BEGIN
  1387.             xsize := 1280;
  1388.             ysize := 1024;
  1389.         END;
  1390.     END;
  1391.     CASE choice1 OF
  1392.         '1' : mode := FindVesaMode(xsize,ysize,8);
  1393.         '2' : mode := FindVesaMode(xsize,ysize,15);
  1394.         '3' : mode := FindVesaMode(xsize,ysize,16);
  1395.         '4' : mode := FindVesaMode(xsize,ysize,24);
  1396.     END;
  1397.     IF mode = 0 THEN BEGIN
  1398.         WriteLn('No such mode could be found !');
  1399.         WriteLn('Switching to to 320x200.');
  1400.         ReadKey;
  1401.         mode := V320x200x256;
  1402.     END;
  1403. END;
  1404.  
  1405. begin { program body }
  1406.   SelectMode;
  1407.   Initialize;
  1408.   ReportStatus;
  1409.  
  1410. {  AspectRatioPlay; }
  1411.   FillEllipsePlay;
  1412.   SectorPlay;
  1413.   WriteModePlay;
  1414.  
  1415.   ColorPlay;
  1416.   { PalettePlay only intended to work on these drivers: }
  1417.   if (GraphDriver = EGA) or
  1418.       (GraphDriver = EGA64) or
  1419.       (GraphDriver = VGA) then
  1420.      PalettePlay;
  1421.   PutPixelPlay;
  1422. {  PutImagePlay; }
  1423.   RandBarPlay;
  1424.   BarPlay;
  1425.   Bar3DPlay;
  1426.   ArcPlay;
  1427.   CirclePlay;
  1428.   PiePlay;
  1429.   LineToPlay;
  1430.   LineRelPlay;
  1431. {  LineStylePlay; }
  1432. {  UserLineStylePlay; }
  1433.   TextDump;
  1434.   TextPlay;
  1435.   CrtModePlay;
  1436.   FillStylePlay;
  1437.   FillPatternPlay;
  1438.   PolyPlay;
  1439.   SayGoodbye;
  1440. {  CloseGraph; }
  1441.   CloseVesa;
  1442. end.
  1443. ***************************************************
  1444.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  1445.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  1446. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  1447. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  1448. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  1449. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  1450.     Color := RandColor;
  1451.     SetColor(Color);
  1452.     SetFillStyle(Random(CloseDotFill)+1, Color);
  1453.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  1454.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  1455.   until KeyPressed;
  1456.   WaitToGo;
  1457. end; { RandBarPlay }
  1458.  
  1459. procedure ArcPlay;
  1460. { Draw random arcs on the screen }
  1461. var
  1462.   MaxRadius : word;
  1463.   EndAngle : word;
  1464.   ArcInfo : ArcCoordsType;
  1465. begin
  1466.   MainWindow('Arc / GetArcCoords demonstration');
  1467.   StatusLine('Esc aborts or press a key');
  1468.   MaxRadius := MaxY div 10;
  1469.   repeat
  1470.     SetColor(RandColor);
  1471.     EndAngle := Random(360);
  1472.     SetLineStyle(SolidLn, 0, NormWidth);
  1473.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  1474.     GetArcCoords(ArcInfo);
  1475.     with ArcInfo do
  1476.     begin
  1477.       Line(X, Y, XStart, YStart);
  1478.       Line(X, Y, Xend, Yend);
  1479.     end;
  1480.   until KeyPressed;
  1481.   WaitToGo;
  1482. end; { ArcPlay }
  1483.  
  1484. procedure PutPixelPlay;
  1485. { Demonstrate the PutPixel and GetPixel commands }
  1486. const
  1487.   Seed   = 1962; { A seed for the random number generator }
  1488.   NumPts = 2000; { The number of pixels plotted }
  1489.   Esc    = #27;
  1490. var
  1491.   I : word;
  1492.   X, Y, Color : word;
  1493.   XMax, YMax  : integer;
  1494.   ViewInfo    : ViewPortType;
  1495. begin
  1496.   MainWindow('PutPixel / GetPixel demonstration');
  1497.   StatusLine('Esc aborts or press a key...');
  1498.  
  1499.   GetViewSettings(ViewInfo);
  1500.   with ViewInfo do
  1501.   begin
  1502.     XMax := (x2-x1-1);
  1503.     YMax := (y2-y1-1);
  1504.   end;
  1505.  
  1506.   while not KeyPressed do
  1507.   begin
  1508.     { Plot random pixels }
  1509.     RandSeed := Seed;
  1510.     I := 0;
  1511.     while (not KeyPressed) and (I < NumPts) do
  1512.     begin
  1513.       Inc(I);
  1514.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  1515.     end;
  1516.  
  1517.     { Erase pixels }
  1518.     RandSeed := Seed;
  1519.     I := 0;
  1520.     while (not KeyPressed) and (I < NumPts) do
  1521.     begin
  1522.       Inc(I);
  1523.       X := Random(XMax)+1;
  1524.       Y := Random(YMax)+1;
  1525.       Color := GetPixel(X, Y);
  1526.         if Color = RandColor then
  1527.           PutPixel(X, Y, 0);
  1528.      end;
  1529.   end;
  1530.   WaitToGo;
  1531. end; { PutPixelPlay }
  1532.  
  1533. procedure PutImagePlay;
  1534. { Demonstrate the GetImage and PutImage commands }
  1535.  
  1536. const
  1537.   r  = 20;
  1538.   StartX = 100;
  1539.   StartY = 50;
  1540.  
  1541. var
  1542.   CurPort : ViewPortType;
  1543.  
  1544. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  1545. var
  1546.   Step : integer;
  1547. begin
  1548.   Step := Random(2*r);
  1549.   if Odd(Step) then
  1550.     Step := -Step;
  1551.   X := X + Step;
  1552.   Step := Random(r);
  1553.   if Odd(Step) then
  1554.     Step := -Step;
  1555.   Y := Y + Step;
  1556.  
  1557.   { Make saucer bounce off viewport walls }
  1558.   with CurPort do
  1559.   begin
  1560.     if (x1 + X + Width - 1 > x2) then
  1561.       X := x2-x1 - Width + 1
  1562.     else
  1563.       if (X < 0) then
  1564.         X := 0;
  1565.     if (y1 + Y + Height - 1 > y2) then
  1566.       Y := y2-y1 - Height + 1
  1567.     else
  1568.       if (Y < 0) then
  1569.         Y := 0;
  1570.   end;
  1571. end; { MoveSaucer }
  1572.  
  1573. var
  1574.   Pausetime : word;
  1575.   Saucer    : pointer;
  1576.   X, Y      : integer;
  1577.   ulx, uly  : word;
  1578.   lrx, lry  : word;
  1579.   Size      : word;
  1580.   I         : word;
  1581. begin
  1582.   ClearDevice;
  1583.   FullPort;
  1584.  
  1585.   { PaintScreen }
  1586.   ClearDevice;
  1587.   MainWindow('GetImage / PutImage Demonstration');
  1588.   StatusLine('Esc aborts or press a key...');
  1589.   GetViewSettings(CurPort);
  1590.  
  1591.   { DrawSaucer }
  1592.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  1593.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  1594.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  1595.   Circle(StartX+10, StartY-12, 2);
  1596.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  1597.   Circle(StartX-10, StartY-12, 2);
  1598.   SetFillStyle(SolidFill, MaxColor);
  1599.   FloodFill(StartX+1, StartY+4, GetColor);
  1600.  
  1601.   { ReadSaucerImage }
  1602.   ulx := StartX-(r+1);
  1603.   uly := StartY-14;
  1604.   lrx := StartX+(r+1);
  1605.   lry := StartY+(r div 3)+3;
  1606.  
  1607.   Size := ImageSize(ulx, uly, lrx, lry);
  1608.   GetMem(Saucer, Size);
  1609.   GetImage(ulx, uly, lrx, lry, Saucer^);
  1610. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  1611.  
  1612.   { Plot some "stars" }
  1613.   for I := 1 to 1000 do
  1614.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  1615.   X := MaxX div 2;
  1616.   Y := MaxY div 2;
  1617.   PauseTime := 70;
  1618.  
  1619.   { Move the saucer around }
  1620.   repeat
  1621. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  1622.      Delay(PauseTime);
  1623. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  1624.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  1625.   until KeyPressed;
  1626.   FreeMem(Saucer, size);
  1627.   WaitToGo;
  1628. end; { PutImagePlay }
  1629.  
  1630. procedure PolyPlay;
  1631. { Draw random polygons with random fill styles on the screen }
  1632. const
  1633.   MaxPts = 5;
  1634. type
  1635.   PolygonType = array[1..MaxPts] of PointType;
  1636. var
  1637.   Poly : PolygonType;
  1638.   I, Color : word;
  1639. begin
  1640.   MainWindow('FillPoly demonstration');
  1641.   StatusLine('Esc aborts or press a key...');
  1642.   repeat
  1643.     Color := RandColor;
  1644.     SetFillStyle(Random(11)+1, Color);
  1645.     SetColor(Color);
  1646.     for I := 1 to MaxPts do
  1647.       with Poly[I] do
  1648.       begin
  1649.         X := Random(MaxX);
  1650.         Y := Random(MaxY);
  1651.       end;
  1652.     FillPoly(MaxPts, Poly);
  1653.   until KeyPressed;
  1654.   WaitToGo;
  1655. end; { PolyPlay }
  1656.  
  1657. procedure FillStylePlay;
  1658. { Display all of the predefined fill styles available }
  1659. var
  1660.   Style    : word;
  1661.   Width    : word;
  1662.   Height   : word;
  1663.   X, Y     : word;
  1664.   I, J     : word;
  1665.   ViewInfo : ViewPortType;
  1666.  
  1667. procedure DrawBox(X, Y : word);
  1668. begin
  1669.   SetFillStyle(Style, MaxColor);
  1670.   with ViewInfo do
  1671.     Bar(X, Y, X+Width, Y+Height);
  1672.   Rectangle(X, Y, X+Width, Y+Height);
  1673.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  1674.   Inc(Style);
  1675. end; { DrawBox }
  1676.  
  1677. begin
  1678.   MainWindow('Pre-defined fill styles');
  1679.   GetViewSettings(ViewInfo);
  1680.   with ViewInfo do
  1681.   begin
  1682.     Width := 2 * ((x2+1) div 13);
  1683.     Height := 2 * ((y2-10) div 10);
  1684.   end;
  1685.   X := Width div 2;
  1686.   Y := Height div 2;
  1687.   Style := 0;
  1688.   for J := 1 to 3 do
  1689.   begin
  1690.     for I := 1 to 4 do
  1691.     begin
  1692.       DrawBox(X, Y);
  1693.       Inc(X, (Width div 2) * 3);
  1694.     end;
  1695.     X := Width div 2;
  1696.     Inc(Y, (Height div 2) * 3);
  1697.   end;
  1698.   SetTextJustify(LeftText, TopText);
  1699.   WaitToGo;
  1700. end; { FillStylePlay }
  1701.  
  1702. procedure FillPatternPlay;
  1703. { Display some user defined fill patterns }
  1704. const
  1705.   Patterns : array[0..11] of FillPatternType = (
  1706.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  1707.             OldColor which has a path of pixels of OldColor or NewColor
  1708.             with sides touching back to the seed point, (XSeed, YSeed).
  1709.             Therefore, only pixels of OldColor are modified and no other
  1710.             information is changed.
  1711.  
  1712.             SEE ALSO
  1713.  
  1714.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  1715.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  1716.             SETVIEW
  1717.  
  1718.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  1719.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  1720.             IF WHICHVGA = 0 THEN STOP
  1721.             DUMMY=RES640
  1722.             SETVIEW 100, 100, 539, 379
  1723.             FILLVIEW 10
  1724.             WHILE INKEY$ = ""
  1725.             WEND
  1726.             VIDEOMODESET VMODE
  1727.             END
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.                                                                          63
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.           FONTGETINFO
  1752.  
  1753.             PROTOTYPE
  1754.  
  1755.             SUB FONTGETINFO (Width%, Height%)
  1756.  
  1757.             INPUT
  1758.  
  1759.             no input parameters
  1760.     WEND
  1761.             MOUSEEXIT
  1762.             VIDEOMODESET VMODE
  1763.             END
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.                                                                          86
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.           MOUSECURSORDEFAULT
  1812.  
  1813.             PROTOTYPE
  1814.  
  1815.             SUB MOUSECURSORDEFAULT ()
  1816.  
  1817.             INPUT
  1818.  
  1819.             no input parameters
  1820.  
  1821.             OUTPUT
  1822.  
  1823.             no value returned
  1824.  
  1825.             USAGE
  1826.  
  1827.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  1828.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  1829. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  1830. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  1831. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  1832. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  1833. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  1834. $╤
  1835. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  1836. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  1837. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  1838. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  1839. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  1840. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  1841. ░£▒
  1842. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  1843. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  1844.       end;
  1845.     end;
  1846.   end;
  1847.   WaitToGo;
  1848. end; { UserLineStylePlay }
  1849.  
  1850.  
  1851. procedure SayGoodbye;
  1852. { Say goodbye and then exit the program }
  1853. var
  1854.   ViewInfo : ViewPortType;
  1855. begin
  1856.   MainWindow('');
  1857.   GetViewSettings(ViewInfo);
  1858.   SetTextStyle(TriplexFont, HorizDir, 4);
  1859.   SetTextJustify(CenterText, CenterText);
  1860.   with ViewInfo do
  1861.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  1862.   StatusLine('Press any key to quit...');
  1863.   repeat u